﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

/* Generated  */
namespace EDMXParserV1
{
        [Serializable]
    public class EntityContainerMapping
    {
        public EntityContainerMapping()
        {
            EntitySetMappings = new List<EntitySetMapping>();
            AssociationSetMappings = new List<AssociationSetMapping>();
            FunctionImportMappings = new List<FunctionImportMapping>();
        }

        public String StorageEntityContainer { get; set; }
        public String CdmEntityContainer { get; set; }

        public List<EntitySetMapping> EntitySetMappings { get; set; }
        public List<AssociationSetMapping> AssociationSetMappings { get; set; }
        public List<FunctionImportMapping> FunctionImportMappings { get; set; }

        public static EntityContainerMapping New(System.Xml.XmlNode Node)
        {
            EntityContainerMapping EntityContainerMapping = new EntityContainerMapping();
            foreach (XmlAttribute Attribute in Node.Attributes)
            {
                switch (Attribute.Name)
                {
                    case "StorageEntityContainer":
                        EntityContainerMapping.StorageEntityContainer = Attribute.Value;
                        break;
                    case "CdmEntityContainer":
                        EntityContainerMapping.CdmEntityContainer = Attribute.Value;
                        break;
                    default:
                        Globals.AttributeSwitchCoder(Attribute);
                        break;
                }
            }

            foreach (XmlNode ChildNode in Node.ChildNodes)
            {
                switch (ChildNode.Name)
                {
                    case "EntitySetMapping":
                        EntitySetMapping EntitySetMapping = EntitySetMapping.New(ChildNode);
                        EntityContainerMapping.EntitySetMappings.Add(EntitySetMapping);
                        break;
                    case "AssociationSetMapping":
                        AssociationSetMapping AssociationSetMapping =AssociationSetMapping.New(ChildNode);
                        EntityContainerMapping.AssociationSetMappings.Add(AssociationSetMapping);
                        break;
                    case "FunctionImportMapping":
                        FunctionImportMapping FunctionImportMapping = FunctionImportMapping.New(ChildNode);
                        EntityContainerMapping.FunctionImportMappings.Add(FunctionImportMapping);
                        break;
                    default:

                        Globals.NodeSwitchCoder(ChildNode);
                        break;
                }
            }

            return EntityContainerMapping;

        }
    }
}
